

names = {
    "user01" : {"name":"haha","tel":"123123123","age":"20"},
    "user02" : {"name":"bob","tel":"22234132"},
    "user03" : {"name":"jack","tel":"444334"},
    "user04" : {"name":"tom","tel":"665566"},
}

#serch
# print(names["user01"]["age"])
# print(names.get("user05","不存在"))  #如果没有返回none或自定义值"不存在",如果有则返回对应的值
# #add
# names["user06"] = ["syan",33,"IT"]
# #update,修改
# names["user02"]["name"] = "abc"
# print(names)
# #delete
# names.pop("user03")  #删除指定值
# print(names.pop("user03"))   #删除指定值并将删除的打印
# del names["user04"]
# print(names)
# names = ["jack","bob","tom"]
# print(dict.fromkeys(names,44))
# names.values()
# for key in names:
#     print(key,names[key])
# print(names.keys())  #打印所有的key
# print(names.values())  #打印所有的values
# names.popitem()  #随机删除一个信息
# names.setdefault("user07","qwe")   #获取一个值，如果存在则打印，不存在则增加

# d1 = {"user02":"hhhh",1:333,2:444}
# names.update(d1)    #将字典d1合并到names中，如果有重复的值则用新值覆盖旧值，如果没有则添加


print(names)
